package br.ufmt.eit.cursos.util;

import javax.faces.context.FacesContext;

//FacesUtil.java
public class FacesUtil {
      // remove objeto da sessao
      public static void removeSessionMapValue(String key) {
              FacesContext.getCurrentInstance().getExternalContext().getSessionMap()
                              .remove(key);
      }

      // Getters
      // -----------------------------------------------------------------------------------
      public static Object getRequestMapValue(String key) {
              return FacesContext.getCurrentInstance().getExternalContext()
                              .getRequestMap().get(key);
      }

      // Setters
      // -----------------------------------------------------------------------------------
      public static void setRequestMapValue(String key, Object value) {
              FacesContext.getCurrentInstance().getExternalContext().getRequestMap()
                              .put(key, value);
      }

      // Getters
      // -----------------------------------------------------------------------------------
      public static Object getSessionMapValue(String key) {
              return FacesContext.getCurrentInstance().getExternalContext()
                              .getSessionMap().get(key);
      }

      // Setters
      // -----------------------------------------------------------------------------------
      public static void setSessionMapValue(String key, Object value) {
              FacesContext.getCurrentInstance().getExternalContext().getSessionMap()
                              .put(key, value);
      }
}

